#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[5];
	while(cin>>a[1]>>a[2]>>a[3]>>a[4])
	{
		sort(a+1,a+5,greater<int>());
		cout<<(a[2]*100+a[3]*10+a[4])*a[1]<<endl;
	}
    return 0;
}
